<include file="public@header"/>

</head>
<body>

<div class="wrap js-check-wrap">

    <form class="well form-inline margin-top-20" method="get" action="{:url('admin/order/index')}" >
        产品名称:
        <select name="g_id" class="form-control"  id="g_id">
            <option  value="">全部</option>
            <volist name="$goods_all" id="vo">
                <option  value="{$vo.g_id}">{$vo.g_name}</option>
            </volist>
        </select>
        支付状态：
        <select name="order_status" class="form-control"  id="order_status">
            <option  value="">全部</option>
            <option  value="2">已支付</option>
            <option  value="1">待支付</option>
        </select>
        订单号：
        <input type="text" class="form-control" name="order_number" value="{$order_number}">
        联系方式：
        <input type="text" name="phone" class="form-control" value="{$phone}">
        时间范围：
        <input type="text" name="create_time_min" class="form-control datetime" value="{$create_time_min}">
        -
        <input type="text" name="create_time_max" class="form-control datetime" value="{$create_time_max}">
        <button class="btn btn-primary">搜索</button>
    </form>
    <table id="table">

    </table>

</div>

</body>
</html>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/js/layer\layer.js"></script>
<script src="__STATIC__/js/lay_date/laydate.js"></script>

<!--表格插件-->
<link rel="stylesheet" href="__STATIC__/js/table/bootstrap-table.scss">
<script src="__STATIC__/js/table/bootstrap-table.js"></script>
<script src="__STATIC__/js/table/locale/bootstrap-table-zh-CN.js"></script>
<script>
    $(function () {
        $('.datetime').each(function () {
            laydate.render({
                elem:this,
                type:'datetime'
            })
        })

        var table = $('#table');
        table.bootstrapTable({
            locale: "zh-CN",
            url: '{:cmf_url("index")}',
            pagination:true,
            sidePagination:'server',
            pageSize:'25',
            columns:[
                {
                    field:'order_id',
                    title:'编号'
                },
                {
                    field:'select_pas',
                    title:'订单号',
                    events:{
                        'click .kan-ka-mi':function (e,v,r,i) {
                            layer.open({
                                type:2,
                                area:['60%','60%'],
                                content:'{:cmf_url("admin/goods/code_password_info")}?order_number='+r.order_number
                            })
                        }
                    },
                    formatter:function (v,r,i) {
                        return '<a href="javascript:;" class="kan-ka-mi">'+r.order_number+'</a>';
                    }
                },
                {
                    field:'goods_money',
                    title:'产品价格+商家加价+购买数量',
                    formatter:function (v,r,i) {
                        return r.goods_money+'+'+r.shop_add_money+'*'+r.order_count+'='+ ((parseFloat(r.goods_money)+parseFloat(r.shop_add_money))*parseFloat(r.order_count))+'元'
                    }
                },
                {
                    field:'create_time',
                    title:'创建时间'
                },
                {
                    field:'phone',
                    title:'联系方式'
                },
                {
                    field:'g_name',
                    title:'产品名称',

                },

                {
                    field:'order_status',
                    title:'支付状态',
                    formatter:function (v,r,i) {
                        var val = v==1?'待支付':'已支付';
                        return val+'-'+r.bay_type;
                    }
                },
                // {
                //     field:'button',
                //     title:'操作',
                //     events:{
                //       'click .bu-dan':function (e,v,r,i) {
                //           layer.confirm('确定要补单',function () {
                //               layer.load(1);
                //               $.get('')
                //           })
                //       }
                //     },
                //     formatter:function (v,r,i) {
                //         //补单
                //         var btn = new Array();
                //         if(r.order_status == 2){
                //             btn.push('<a href="javascript:;" class="btn btn-info btn-xs bu-dan">补单</a>');
                //         }
                //         return btn.join('');
                //     }
                // }
            ],
            queryParams:function (params) {
                return $.extend({},params,JSON.parse('{$get_all}'));
            }
        })

        function select_c(id,val){
            $(id).find('option').each(function () {
                if($(this).val() == val){
                    $(this).prop('selected',true);
                }
            })
        }
        function queryParams(params) {

        }
        select_c('#g_id','{$g_id}');
        select_c('#order_status','{$order_status}');

    })
</script>